{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Celsius():\n",
    "    def __init__(self, temp=0):\n",
    "        self._temp = temp\n",
    "    \n",
    "    def convertFarenheith(self):\n",
    "        return (self._temp*1.8) + 32\n",
    "    \n",
    "    def get_temp(self):\n",
    "        return self._temp\n",
    "\n",
    "    def set_temp(self, temp):\n",
    "        assert temp >= -273, \"No hay temperaturas menores a 273\"\n",
    "        self._temp = temp\n",
    "\n",
    "    temperature = property(get_temp,set_temp)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Celsius():\n",
    "    def __init__(self, temp=0):        \n",
    "        self._temp = temp\n",
    "    \n",
    "    def convertFarenheith(self):\n",
    "        return (self._temp*1.8) + 32\n",
    "    \n",
    "    @property\n",
    "    def temperature(self):\n",
    "        return self._temp\n",
    "\n",
    "    @temperature.setter\n",
    "    def temperature(self, temp):\n",
    "        assert temp >= -273, \"No hay temperaturas menores a 273\"\n",
    "        self._temp = temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "45\n"
     ]
    }
   ],
   "source": [
    "c = Celsius(45)\n",
    "print(c.temperature)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90\n"
     ]
    }
   ],
   "source": [
    "c.temperature = 90\n",
    "print(c.temperature)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "ename": "AssertionError",
     "evalue": "No hay temperaturas menores a 273",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAssertionError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[0;32mIn [20], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtemperature\u001b[49m \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m300\u001b[39m\n",
      "Cell \u001b[0;32mIn [17], line 14\u001b[0m, in \u001b[0;36mCelsius.temperature\u001b[0;34m(self, temp)\u001b[0m\n\u001b[1;32m     12\u001b[0m \u001b[38;5;129m@temperature\u001b[39m\u001b[38;5;241m.\u001b[39msetter\n\u001b[1;32m     13\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mtemperature\u001b[39m(\u001b[38;5;28mself\u001b[39m, temp):\n\u001b[0;32m---> 14\u001b[0m     \u001b[38;5;28;01massert\u001b[39;00m temp \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m273\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo hay temperaturas menores a 273\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m     15\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_temp \u001b[38;5;241m=\u001b[39m temp\n",
      "\u001b[0;31mAssertionError\u001b[0m: No hay temperaturas menores a 273"
     ]
    }
   ],
   "source": [
    "c.temperature = -300\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10.4 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
